//
//  UIActivityIndicatorViewViewController.swift
//  Example
//
//  Created by T AO on 2022/2/15.
//

import UIKit
import RxSwift
import RxCocoa

class UIActivityIndicatorViewViewController: BaseViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        activityIndicatorRx()
    }

}

extension UIActivityIndicatorViewViewController {
    private func activityIndicatorRx() {
        let indicator = UIActivityIndicatorView(frame: CGRect(x: 100, y: 200, width: 50, height: 50))
        indicator.color = .blue
        view.addSubview(indicator)
        
        let switchBtn = UISwitch(frame: CGRect(x: 100, y: 100, width: 50, height: 50))
        view.addSubview(switchBtn)
        
        switchBtn.rx.value
            .bind(to: indicator.rx.isAnimating)
            .disposed(by: disposeBag)
    }
}
